#include <iostream>
#include "global_const.h"
#include "lab_reservation.h"
#include "computer_lab.h"
using namespace std;

int main()
{
    init_lab();  // 初始化机房信息

    int choice;
    while (true)
    {
        cout << "======================  欢迎来到房预约系统  =====================" << endl;
        cout << "\t\t ------------------------------\n";
        cout << "\t\t|                               |\n";
        cout << "\t\t|          1.学生代表           |\n";
        cout << "\t\t|                               |\n";
        cout << "\t\t|          2.教    师           |\n";
        cout << "\t\t|                               |\n";
        cout << "\t\t|          3.管 理 员           |\n";
        cout << "\t\t|                               |\n";
        cout << "\t\t|          0.退    出           |\n";
        cout << "\t\t|                               |\n";
        cout << "\t\t -------------------------------\n";
        cout << "输入您的选择: ";

        cin >> choice;

        Identity *identity = NULL;
        switch (choice)
        {
        case 1: // 学生
            identity = login(choice, STUDENT_FILE);
            break;
        case 2: // 教师
            identity = login(choice, TEACHER_FILE);
            break;
        case 3: // 管理员
            identity = login(choice, ADMIN_FILE);
            break;
        case 0:
        {
            cout << "欢迎下次使用" << endl;
            exit(0);
        }
        default:
        {
            cout << "输入错误" << endl;
            break;
        }
        }
        if (identity == NULL)
        {
            cout << "系统错误" << endl;
            exit(0);
        }
        manage(identity);
    }

    return 0;
}